<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddIndexOrderIdTaskIdInOrderTaskListTable extends AbstractMigration
{
    public function up()
    {
        // 一个订单 任务id唯一
        $this->table('order_task_list')->addIndex(['order_id', 'task_id'], ['name' => 'idx_unique_order_id_task_id', 'type' => 'unique'])->save();
    }

    public function down()
    {
        $this->table('order_task_list')->removeIndexByName('idx_unique_order_id_task_id')->save();
    }
}
